package com.ruoyi.work.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.work.mapper.WorkClientMapper;
import com.ruoyi.work.domain.WorkClient;
import com.ruoyi.work.service.IWorkClientService;
import com.ruoyi.common.core.text.Convert;

/**
 * 客户管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-21
 */
@Service
public class WorkClientServiceImpl implements IWorkClientService 
{
    @Autowired
    private WorkClientMapper workClientMapper;

    /**
     * 查询客户管理
     * 
     * @param clientId 客户管理主键
     * @return 客户管理
     */
    @Override
    public WorkClient selectWorkClientByClientId(Long clientId)
    {
        return workClientMapper.selectWorkClientByClientId(clientId);
    }

    /**
     * 查询客户管理列表
     * 
     * @param workClient 客户管理
     * @return 客户管理
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<WorkClient> selectWorkClientList(WorkClient workClient)
    {
        return workClientMapper.selectWorkClientList(workClient);
    }

    /**
     * 新增客户管理
     * 
     * @param workClient 客户管理
     * @return 结果
     */
    @Override
    public int insertWorkClient(WorkClient workClient)
    {
        workClient.setCreateTime(DateUtils.getNowDate());
        return workClientMapper.insertWorkClient(workClient);
    }

    /**
     * 修改客户管理
     * 
     * @param workClient 客户管理
     * @return 结果
     */
    @Override
    public int updateWorkClient(WorkClient workClient)
    {
        workClient.setUpdateTime(DateUtils.getNowDate());
        return workClientMapper.updateWorkClient(workClient);
    }

    /**
     * 批量删除客户管理
     * 
     * @param clientIds 需要删除的客户管理主键
     * @return 结果
     */
    @Override
    public int deleteWorkClientByClientIds(String clientIds)
    {
        return workClientMapper.deleteWorkClientByClientIds(Convert.toStrArray(clientIds));
    }

    /**
     * 删除客户管理信息
     * 
     * @param clientId 客户管理主键
     * @return 结果
     */
    @Override
    public int deleteWorkClientByClientId(Long clientId)
    {
        return workClientMapper.deleteWorkClientByClientId(clientId);
    }
}
